package com.hwg.shiliupro.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hwg.shiliupro.dto.LoginDto;
import com.hwg.shiliupro.po.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    public User login(LoginDto loginDto);

    public List<User> selectByPageAndCondition(
            @Param("beginIndex") Integer beginIndex,
            @Param("pageSize") Integer pageSize,
            @Param("number") String number,
            @Param("name") String name,
            @Param("sgroup") String sgroup,
            @Param("order") String order);

    public int selectCount();

    public int insertUser(User user);

    public User selectByMail(String mail);

    public boolean updateProtectCode(@Param("id") Integer id, @Param("uuid") String uuid);

    public int updatePasswordByprotectCode(@Param("protectCode") String protectCode, @Param("password") String password);

    /**
     * 通过id拉黑用户
     *
     * @param id   id
     * @param endTime 截至时间
     * @return int
     */
    public int blockById(@Param("id")Integer id,@Param("endTime")String endTime,@Param("beginTime") String beginTime);

    /**
     * 获得已拉黑用户
     *
     * @return {@link List}<{@link User}>
     */
    List<User> getBlocks();

    /**
     * 是否进入黑名单
     *
     * @param id id
     * @return boolean
     */
    User isBlock(Integer id);
}
